<?php

require_once 'core/model/table/row/layout.php';

class Core_Model_Table_Layout extends Model_Table
{

    protected $_name = 'core_layouts';

    protected $_rowClass = 'Core_Model_Table_Row_Layout';

    

    /**
     * get area
     * get all area mode
     */
    public function getAreaAsOptions()
    {
        $table = Agis::getTable('core@layout.area');

        $ret = array();

        foreach ($table->fetchAll() as $row)
        {
            $ret[$row -> area] = $row -> title;
        }
        return $ret;
    }

    /**
     * get area
     * get all area mode
     */
    public function getAllowAsOptions($area)
    {
        $table = Agis::getTable('core@layout.allow');
        $select = $table -> select() -> where('area=?', (string)$area);
        $ret = array();

        foreach ($table->fetchAll() as $row)
        {
            $ret[$row -> area] = $row -> name;
        }
        return $ret;
    }

}
